<!DOCTYPE html>
<html>
  <title>JS与Flutter通信</title>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/flutter-bridge/dist/index.umd.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.15.1/vconsole.min.js"></script>
    <script>
      new VConsole();
    </script>
  </head>

  <body class="p-[20px] text-[14px]"></body>

  <script>
    const $ = (selector) => document.querySelector(selector);

    //获取设备信息
    async function getMobileList() {
      // const { data } = await flutterBridge.call({ name: "getInfo" });
      const { data: mobiles } = await flutterBridge.call({
        name: `net${Date.now()}`,
        params: {
          path: "/v1/tools/mobile_list",
          method: "GET",
        },
      });

      document.body.innerHTML = JSON.stringify(mobiles);
      console.log(mobiles);
    }

    window.onload = function () {
      flutterBridge.setup(() => {
        getMobileList();
      });
    };
  </script>
</html>
